<?php

use yii\db\Schema;
use yii\db\Migration;

class m170516_034941_add_cpe_template extends Migration
{
    public function up()
    {
        $sql = <<<FINE
insert into {{%creative_template}} (id, name, code) values (4, 'COD POPUP 模板', '<div class="am_ad_container" style="position: relative; display: inline-block; border: none; padding: 0px; margin: 0px; visibility: visible; overflow: hidden;">
    <img src="{!dsp_show_url}" style="display:none;" />
    <img src="//bsch.serving-sys.com/BurstingPipe/adServer.bs?cn=tf&c=19&mc=imp&pli=21421311&PluID=0&ord=%5Btimestamp%5D&rtu=-1" style="display:none;" />
    <img src="//g.cn.miaozhen.com/x/k=2047006&p=76WSJ&dx=__IPDX__&rt=2&ns=__IP__&ni=__IESID__&v=__LOC__&xa=__ADPLATFORM__&tr=__REQUESTID__&o=" style="display:none;" />
    <script type="text/javascript" charset="utf-8">
        am_id = "{!dsp_creative_id}";
        am_tp = "{!dsp_creative_type}";
        am_wt = "{!dsp_creative_width}";
        am_ht = "{!dsp_creative_height}";
        am_ml = "{!dsp_creative_material}";
        am_ck = "{!vam_click_url}{!dsp_click_url}{!dsp_creative_monitor}{!dsp_creative_landingpage}";
        am_impr = "{!dsp_creative_impr}";
        am_logo = "{!dsp_creative_logo}";
    </script>
    <script type="text/javascript" charset="utf-8" class="ads_power_by_admath" id="am_{!dsp_creative_id}{!dsp_creative_width}{!dsp_creative_height}"
      src="{!dsp_cdn_url}/am_d.js"></script>
</div>');
FINE;
        return $this->execute($sql);
    }

    public function down()
    {
        echo "m170516_034941_add_cpe_template cannot be reverted.\n";

        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
